package com.example.demo.model.custom;

import com.baidu.bas.annotation.fun.DataProxy;
import com.baidu.bas.db.dao.EruptJpaDao;
import com.deepzero.mmma.api.enums.CampaignStatus;
import com.example.demo.model.SimpleTask;
import com.example.demo.model.TaskOverviewReport;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;

/**
 * @author liuzhenchuan@foxmail.com
 * @date 2020/12/29
 */
@Component
public class SimpleTaskDataProxy implements DataProxy<SimpleTask> {

    @Resource
    private JdbcTemplate jdbcTemplate;

    @Resource
    private EruptJpaDao eruptJpaDao;

    @Override
    public void beforeAdd(SimpleTask simpleTask) {
        simpleTask.setOverviewReport(new TaskOverviewReport());
        simpleTask.setStatus(CampaignStatus.WAIT_AUDIT);
        simpleTask.setCreativeType(simpleTask.getCreativeType());
    }

    @Override
    public void afterFetch(Collection<Map<String, Object>> list) {
        //todo 填充进入人数和转化人数
    }

    @Override
    public void beforeUpdate(SimpleTask account) {

    }


    @Override
    public void afterAdd(SimpleTask simpleTask) {

    }

    @Override
    public void afterUpdate(SimpleTask simpleTask) {

    }
}
